jQuery(function ($) {
    var win = $(window),
        img = $("#welcome .bg");

    win.on("resize",function () {
        win.width() / win.height() < 1.778 ? img.css({
            height: "100%",
            width: "auto"
        }) : img.removeAttr("style");
    }).resize();

    var welcomeTimer = null;
    var imgsrc = $("#welcome1 .bg").attr('src');
    BXW.loadImage(imgsrc, function () {
        welcomeTimer = setTimeout(function () {
            $("#welcome1").fadeOut(700);
            setTimeout(function () {
                $("#welcome2").fadeOut(700);
                setTimeout(function () {
                    $("#welcome3").fadeOut(700);
                    setTimeout(function () {
                        exit();
                    }, 3700);
                }, 3200);
            }, 3200);
        }, 3200);

        setTimeout(function () {
            $("#welcome2, #welcome3, #welcome4").show();
        }, 1000);
    });

    $("#welcome .skip").click(function () {
        exit();
    });
   
    function exit() {
        clearInterval(welcomeTimer);
        $("#welcome").fadeOut(700, function () {
            $(this).remove();
			 /*默认是隐藏的,执行的时候显示*/
    		$("#wrapper").fadeIn(10);
        });
    };
});